package com.changgou.feign;

import com.changgou.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@FeignClient("goods")
public interface SkuFeign {


    /**
     * 根据spuid查询有效sku列表
     * @param spuId
     * @return
     */
    @GetMapping("/sku/spu/{spuId}")
    public Result findSkuListBySpuId(@PathVariable("spuId") String spuId);


    /***
     * 分页搜索实现
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "/sku/search/{page}/{size}" )
    public Result findPage(@RequestParam Map searchMap, @PathVariable("page")  int page, @PathVariable("size")  int size);


    /***
     * 根据ID查询数据
     * @param id
     * @return
     */
    @GetMapping("/sku/{id}")
    public Result findById(@PathVariable("id") String id);


    /**
     * 批量扣减库存
     * @param map
     * @return
     */
    @PostMapping("/sku/deduction_stock")
    public  Result deductionStock(@RequestBody Map<String,Integer> map);

}
